package com.ysx.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

/**
 * @author yyj
 * @date 2019/5/18
 */
@RestController
public class ConsumerController {

    @Autowired
    private WebClient.Builder webClentBuilder;

    @GetMapping("test")
    public Mono<String> test(String name) {
        return webClentBuilder.build()
                .get()
                .uri("http://ysx-nacos-provider/name?name=" + name)
                .retrieve()
                .bodyToMono(String.class);
    }
}
